<?php
if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
$ui = new UI();
$tpl = new Template2();
global $curruser;
if ($curruser['acl'] == 5 && $curruser['percent_sw'] == 1)
{
    err("你是固定占成的大股东，不能走飞！");
}
include( "class/class.Bnowconfig.php" );
$Bnowconfig = new Bnowconfig(0, $curruser['id']);
include( "member/news.php" );
if ($curruser['enabled'] == 0 || $curruser['enabled'] == 2)
{
    $ui->showErrorPage("<p class=error>帐号已被暂停使用</p>");
    exit();
}
$userlist = GetUserList($curruser['id']);
if ($userlist == "")
{
    $ui->showErrorPage("<p>还没有建立会员！</p>");
    exit();
}
$rs = getdb("select id,open from lotto where open>='" . date("Y-m-d") . "' order by open");
if ($rs->eof)
{
    $ui->showErrorPage("<p>目前没有期数！</p>");
    exit();
}
$lotto_id = $rs->f['id'];
$open = $rs->f['open'];
$rs->close();
$tpl->set("lotto_id", $lotto_id);
$tpl->set("open", $open);
$conf = new config();
$waitbet = $conf->get("waitbet");
$stopbet = $conf->get("stopbet");
if (date("Y-m-d") == $open && $conf->get("startbet") <= date("Hi") && date("Hi") < $stopbet && $conf->get("protect_start") == 0)
{
    $conf->set("protect_start", 1);
}
$t1 = strtotime($open . " " . $stopbet);
$t2 = strtotime($open . " " . $waitbet);
$tpl->Set("timestap", $t1 - systime());
$tpl->set("phptime", systime());
$bo0 = isset($_COOKIE['bo0']) ? $_COOKIE['bo0'] : min(0 - 5000, $Bnowconfig->getVal("alert0"));
$tpl->set("bo0", $bo0);
$tpl->set("b13", "");
if ($conf->get("protect_start") == 0)
{
    $tpl->set("startnowdisable", "disabled");
}
include_once( "class_6h/class.menu.php" );
$fieldArr = array("open" => $open, "lotto_id" => $lotto_id, "split_id" => 1);
$onlineMenu = new menu_6h(12, $fieldArr);
$selectid = getvar("select") == "" ? 0 : getvar("select");
$menuList = $onlineMenu->getMenu($selectid);
$tpl->set("menuList", $menuList);
unset($onlineMenu);
$tpl->load("main", "bnow1.htm");
$tpl->set("jslang", $g_conf['language']);
$tpl->show("main");
$ui->footer();